package com.itheima.controller;

import com.itheima.pojo.User;
import com.itheima.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户信息Controller
 */
@RestController // @ResponseBody -> 作用: 将controller返回值直接作为响应体的数据直接响应; 返回值是对象/集合->json->响应
public class UserController {
    @Resource(name = "userServiceImpl")
    private UserService userService;

    //@Qualifier("userServiceImpl")
    //@Autowired
    //private UserService userService;
    @RequestMapping("/list")
    public List<User> list() {
        List<User> users = userService.findAll();
        return users;
    }


}
